Two machines are connected by using a switch device, to implement mutual access of more than two machines, that is, a local area network is formed. In the local area network, because the number of machines is small, it is very easy to configure an Internet Protocol (IP) address of each machine, and a conflict occurs rarely. In the local area network, the two machines may directly access each other according to the IP address.
A public network is a global-based, cross-country, or cross-province network. In the public network, a large number of machines are running. If each machine needs to occupy one IP address, a large number of IP address resources are consumed.
Currently, a network address translation (NAT) technology is generally used, to implement support for accessing a public network by a large number of the machines in a case of limited IP resources.
For a source machine and a destination machine for sending and receiving an IP packet, a certain mapping relationship exists between their system layers and a Transmission Control Protocol (TCP)/IP protocol. For example, a physical network adapter correspondingly processes a data-link layer and a physical layer; an operating system is used to process a transport layer and a network layer; the operating system also provides a Socket application programming interface (API) for a service client to develop a specific application protocol; the service client corresponds to an application layer protocol.
The Socket API is a group of functions provided by the operating system for an application program to develop a network application.
In the prior art, a virtual network adapter technology is generally used to implement an interconnection on the public network between the service client on one local area network and a service server on another local area network. The virtual network adapter technology loads an IP packet hook at an operating system layer of a client and a server, and after hooking the IP packet with a specific destination address, sends the IP packet through a tunnel. The virtual network adapter technology adds, between the operating system and the physical network adapter, a virtual network adapter layer, which is used to capture the IP packet delivered by the operating system to a network adapter, and convert a specific IP packet, thereby implementing the interconnection between the service client and the service server.
Using the virtual network adapter technology may implement the interconnection on the public network between the service client on one local area network and the service server on another local area network. However, this technology has the following technical defects.
1. A virtual network adapter is a process that runs in a kernel, a software conflict is severe, and compatibility and stability of a system are not good.
2. When a fault occurs, a serious problem such as a machine blue screen of death is caused.
3. An underlying logic of the operating system is changed, which is easily recognized as a virus by antivirus software.
4. Virtual network adapter technologies for multiple operating systems (Linux, MAC, iOS, and so on) need to be developed.
For the defects of the prior art, the present invention provides a local area network traversal technical solution based on Socket remote invocation, to implement that the service client remotely invokes Socket within a server local area network and communicates with the server as if within the same local area network.